import request from '@/utils/request'

// 查询员工打卡记录列表
export function listAttendance(query) {
  return request({
    url: '/system/attendance/list',
    method: 'get',
    params: query
  })
}

// 查询员工打卡记录详细
export function getAttendance(attendanceId) {
  return request({
    url: '/system/attendance/' + attendanceId,
    method: 'get'
  })
}

// 新增员工打卡记录
export function addAttendance(data) {
  return request({
    url: '/system/attendance',
    method: 'post',
    data: data
  })
}

// 修改员工打卡记录
export function updateAttendance(data) {
  return request({
    url: '/system/attendance',
    method: 'put',
    data: data
  })
}

// 删除员工打卡记录
export function delAttendance(attendanceId) {
  return request({
    url: '/system/attendance/' + attendanceId,
    method: 'delete'
  })
}

// 用户打卡签到
export function clockIn(data) {
  return request({
    url: '/system/attendance/clockIn',
    method: 'post',
    data: data
  })
}

// 用户打卡签退
export function clockOut(data) {
  return request({
    url: '/system/attendance/clockOut',
    method: 'post',
    data: data
  })
}

// 获取当天打卡状态
export function getTodayStatus() {
  return request({
    url: '/system/attendance/today',
    method: 'get'
  })
}

// 获取打卡统计数据
export function getAttendanceStats(params) {
  return request({
    url: '/system/attendance/stats',
    method: 'get',
    params: params
  })
}

// 获取打卡图表数据
export function getAttendanceChartData(params) {
  return request({
    url: '/system/attendance/chart',
    method: 'get',
    params: params
  })
}

// 更新打卡设置
export function updateAttendanceSettings(data) {
  return request({
    url: '/system/attendance/settings',
    method: 'put',
    data: data
  })
}

// 获取考勤设置
export function getAttendanceSettings() {
  return request({
    url: '/system/attendance/settings',
    method: 'get'
  })
}

// 补卡申请
export function applyReapply(data) {
  return request({
    url: '/system/attendance/reapply',
    method: 'post',
    data: data
  })
}

// 请假申请
export function applyLeave(data) {
  return request({
    url: '/system/attendance/leave',
    method: 'post',
    data: data
  })
}

// 获取补卡申请列表
export function listReapply(query) {
  return request({
    url: '/system/attendance/reapply/list',
    method: 'get',
    params: query
  })
}

// 获取请假申请列表
export function listLeave(query) {
  return request({
    url: '/system/attendance/leave/list',
    method: 'get',
    params: query
  })
}

// 删除补卡申请
export function deleteReapply(reapplyId) {
  return request({
    url: '/system/attendance/reapply/' + reapplyId,
    method: 'delete'
  })
}

// 删除请假申请
export function deleteLeave(leaveId) {
  return request({
    url: '/system/attendance/leave/' + leaveId,
    method: 'delete'
  })
}

// 审批补卡申请
export function approveReapply(reapplyId, data) {
  return request({
    url: '/system/attendance/reapply/approve/' + reapplyId,
    method: 'put',
    data: data
  })
}

// 审批请假申请
export function approveLeave(leaveId, data) {
  return request({
    url: '/system/attendance/leave/approve/' + leaveId,
    method: 'put',
    data: data
  })
} 